package com.qd.common.panda.domain.entity.shop.address;

import com.cdqidi.util.page.BaseQuery;
import com.cdqidi.valid.group.DefaultGroup;
import com.cdqidi.valid.group.DeleteGroup;
import com.cdqidi.valid.group.UpdateGroup;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;

/**
 * 收货地址
 *
 * @author sjk
 */
@EqualsAndHashCode(callSuper = true)
@Getter
@Setter
public class ShopAddressDTO extends BaseQuery {

    /**
     * 主键
     */
    @NotBlank(message = "地址ID不能为空", groups = {DeleteGroup.class, UpdateGroup.class})
    @Size(max = 50, message = "地址ID长度不能超过{max}位", groups = {DeleteGroup.class, UpdateGroup.class})
    private String id;
    /**
     * 收货人姓名
     */
    @NotBlank(message = "收货人姓名不能为空", groups = DefaultGroup.class)
    @Size(max = 100, message = "收货人姓名长度不能超过{max}位", groups = DefaultGroup.class)
    private String name;
    /**
     * 手机号码
     */
    @NotBlank(message = "手机号码不能为空", groups = DefaultGroup.class)
    @Size(max = 20, message = "手机号码长度不能超过{max}位", groups = DefaultGroup.class)
    private String phone;
    /**
     * 所在地区
     */
    @NotBlank(message = "所在地区不能为空", groups = DefaultGroup.class)
    @Size(max = 100, message = "所在地区长度不能超过{max}位", groups = DefaultGroup.class)
    private String region;
    /**
     * 详细地址
     */
    @NotBlank(message = "详细地址不能为空", groups = DefaultGroup.class)
    @Size(max = 100, message = "详细地址长度不能超过{max}位", groups = DefaultGroup.class)
    private String address;
    /**
     * 邮政编码
     */
    @Size(max = 20, message = "邮政编码长度不能超过{max}位", groups = DefaultGroup.class)
    private String postalCode;
    /**
     * 添加时间
     */
    private LocalDateTime addTime;
    /**
     * 修改时间
     */
    private LocalDateTime updateTime;
    /**
     * 默认收货地址
     */
    @Size(max = 50, message = "默认收货地址长度不能超过{max}位", groups = DefaultGroup.class)
    private String defaultAddress;
    /**
     * 用户ID
     */
    @Size(max = 50, message = "用户ID长度不能超过{max}位", groups = DefaultGroup.class)
    private String userId;

    @Override
    public void freeData() {
        this.id = null;
        this.name = null;
        this.phone = null;
        this.region = null;
        this.address = null;
        this.postalCode = null;
        this.addTime = null;
        this.updateTime = null;
        this.defaultAddress = null;
        this.userId = null;
        super.freeData();
    }
}
